package com.jinxi.sign.mode.single;

public class LazySingleton {

    private static LazySingleton lazy = null;

    private LazySingleton() {

    }

    public static LazySingleton getInstance() {
        if (lazy == null) {
            lazy = new LazySingleton();
        }
        return lazy;
    }

    //枷锁安全
    public synchronized static LazySingleton getSafeInstance() {
        if (lazy == null) {
            lazy = new LazySingleton();
        }
        return lazy;
    }

    //锁类
    public static LazySingleton getCheckInstance() {

        synchronized (LazySingleton.class) {
            if (lazy == null) {
                lazy = new LazySingleton();
            }
        }
        return lazy;
    }
}
